package com.zyw.mvc.support;

import com.zyw.orm.dao.BaseDao;
import com.zyw.orm.support.BaseEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;

/**
 * @author zhangyw
 * @date 16/12/22 14:45
 */
public abstract class BaseService<T extends BaseEntity, PK extends Serializable, D extends BaseDao<T, PK>> {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private D dao;

    public void setDao(D dao) {
        this.dao = dao;
    }

    public D getDao() {
        return dao;
    }

    public T get(PK id) {
        return getDao().get(id);
    }
}
